<!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                 <!-- SNS Link -->
                 {% include sns-links.html center=true %}
                
                <p class="copyright text-muted">
                    Copyright {{ site.time | date: '%Y' }} <i class="fa fa-heart" aria-hidden="true" style="color: #0085A1"></i> levi blog. 
                    <br/>
                    <!-- <span class="copyright text-muted" id="geoip"></span>
                    <br/> -->
                    您是本站第<span id="busuanzi_value_site_pv"></span>位小伙伴.
                    <br/>
                    <span class="copyright text-muted" id="count"></span>
                    <br/>
                </p>
                




                    <!-- Theme on <a href="{{ site.github_repo }}">GitHub</a>  -->
                    <!-- <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="100px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user={{ site.github_username }}&repo={{ site.github_username }}.github.io&type=star&count=true" >
                    </iframe> -->
            </div>
        </div>
    </div>
</footer>
<!--不蒜子统计-->
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<!-- ip位置统计，接口为ip-api
<script type="application/javascript">
	function getgeoip(json){
		var ip = json.query;
		var Country = json.country;
		var region = json.regionName;
        var city = json.city;
        var str = "IP:" + ip +" Country:" + Country +" region:" + region +" city：" +city
        document.getElementById('geoip').innerHTML=str;
	}
</script> -->

<script type="application/javascript" src="//ip-api.com/json?lang=zh-CN&callback=getgeoip"></script> -->

<!--运行时间模块-->
<script>
  
    window.setInterval('counter()',1000);
    function counter(){
      var date=new Date();
      var startDate=new Date(2018,06,28,0,0,0);
      var time=(date-startDate)/1000;
      var day=Math.floor(time/(24*60*60));
      var hour=Math.floor(time%(24*60*60)/(60*60));
      var minute=Math.floor(time%(24*60*60)%(60*60)/60);
      var second=Math.floor(time%(24*60*60)%(60*60)%60);
      var str="我的博客已默默运行了" + day + "天" + hour +"时" + minute + "分" + second + "秒";
      document.getElementById('count').innerHTML=str;
    }

    </script>




<!-- jQuery -->
<script src="{{ "/js/jquery.min.js " | prepend: site.baseurl }}"></script>

<!-- Bootstrap Core JavaScript -->
<script src="{{ "/js/bootstrap.min.js " | prepend: site.baseurl }}"></script>

<!-- Custom Theme JavaScript -->
<script src="{{ "/js/hux-blog.min.js " | prepend: site.baseurl }}"></script>


<!-- Simple Jekyll Search -->
<script src="{{ "/js/simple-jekyll-search.min.js" | prepend: site.baseurl }}"></script>



<!-- Service Worker -->
{% if site.service-worker %}
<script src="{{ "/js/snackbar.js " | prepend: site.baseurl }}"></script>
<script src="{{ "/js/sw-registration.js " | prepend: site.baseurl }}"></script>
{% endif %}

<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>

<!-- 
     Because of the native support for backtick-style fenced code blocks 
     right within the Markdown is landed in Github Pages, 
     From V1.6, There is no need for Highlight.js, 
     so Huxblog drops it officially.

     - https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0  
     - https://help.github.com/articles/creating-and-highlighting-code-blocks/ 
     - https://github.com/jneen/rouge/wiki/list-of-supported-languages-and-lexers   
-->
<!--
    <script>
        async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){
            hljs.initHighlightingOnLoad();
        })
    </script>
    <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
-->

{% if page.plchart %}
<!-- jquery.tagcloud.js -->
<script>
    // https://stackoverflow.com/questions/9975810/make-iframe-automatically-adjust-height-according-to-the-contents-without-using
    function resizeIframe(obj) {
        obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
    }

    $(document).ready(function () {
        var $chart = document.querySelector("#chart");
        $chart.onload = function () {
            resizeIframe($chart)
        }
        window.addEventListener("resize", () => {
            resizeIframe($chart)
        });
    })
</script>
{% endif %}

{% if page.title == 'Archive' %}
<!-- jquery.tagcloud.js -->
<script>
        async('{{ "/js/jquery.tagcloud.js" | prepend: site.baseurl }}',function(){
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: {start: '#bbbbee', end: '#2f93b4'},
            };
            $('#tag_cloud a').tagcloud();
        })
    </script>
    <script src='{{ "/js/archive.js " | prepend: site.baseurl }}'></script>
    {% endif %}

<!--fastClick.js -->
<script>
    async("//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->
{% if site.ga_track_id %}
<script>
    // dynamic User by Hux
    var _gaId = '{{ site.ga_track_id }}';
    var _gaDomain = '{{ site.ga_domain }}';

    // Originial
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', _gaId, _gaDomain);
    ga('send', 'pageview');
</script>
{% endif %}


<!-- Baidu Tongji -->
{% if site.ba_track_id %}
<script>
    // dynamic User by Hux
    var _baId = '{{ site.ba_track_id }}';

    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>
{% endif %}


<!-- Side Catalog -->
{% if page.catalog %}
<script type="text/javascript">
    function generateCatalog (selector) {

        // interop with multilangual 
        if ('{{ page.multilingual }}' == 'true') {
            _containerSelector = 'div.post-container.active'
        } else {
            _containerSelector = 'div.post-container'
        }

        // init
        var P = $(_containerSelector),a,n,t,l,i,c;
        a = P.find('h1,h2,h3,h4,h5,h6');

        // clean
        $(selector).html('')

        // appending
        a.each(function () {
            n = $(this).prop('tagName').toLowerCase();
            i = "#"+$(this).prop('id');
            t = $(this).text();
            c = $('<a href="'+i+'" rel="nofollow">'+t+'</a>');
            l = $('<li class="'+n+'_nav"></li>').append(c);
            $(selector).append(l);
        });
        return true;
    }

    generateCatalog(".catalog-body");

    // toggle side catalog
    $(".catalog-toggle").click((function(e){
        e.preventDefault();
        $('.side-catalog').toggleClass("fold")
    }))

    /*
     * Doc: https://github.com/davist11/jQuery-One-Page-Nav
     * Fork by Hux to support padding
     */
    async("{{ '/js/jquery.nav.js' | prepend: site.baseurl }}", function () {
        $('.catalog-body').onePageNav({
            currentClass: "active",
            changeHash: !1,
            easing: "swing",
            filter: "",
            scrollSpeed: 700,
            scrollOffset: 0,
            scrollThreshold: .2,
            begin: null,
            end: null,
            scrollChange: null,
            padding: 80
        });
    });
</script>
{% endif %}


<!-- Multi-Lingual -->
{% if page.multilingual %}
<!-- Handle Language Change -->
<script type="text/javascript">
    // get nodes
    var $zh = document.querySelector(".zh");
    var $en = document.querySelector(".en");
    var $select = document.querySelector("select");

    // bind hashchange event
    // Changes at v1.7.2: change the language flag from hash-basing to in-memory basing
    // due to its confliction with catalog anchors.
    // window.addEventListener('hashchange', _render);

    // handle render
    function _render(_hash){
        var _hash = _hash || window.location.hash;
        // en
        if(_hash == "#en"){
            $select.selectedIndex = 1;
            $en.style.display = "block";
            $en.classList.add("active");
            $zh.style.display = "none";
            $zh.classList.remove("active");
        // zh by default
        }else{
            // not trigger onChange, otherwise cause a loop call.
            $select.selectedIndex = 0;
            $zh.style.display = "block";
            $zh.classList.add("active");
            $en.style.display = "none";
            $en.classList.remove("active");
        }
        // interop with catalog 
        if ("{{ page.catalog }}") generateCatalog(".catalog-body");
    }

    // handle select change
    function onLanChange(index){
        if(index == 0){
            _hash = "#zh"
        }else{
            _hash = "#en"
        }
        _render(_hash)
    }

    // init
    _render();
</script>
{% endif %}

<!-- Simple Jekyll Search -->
<script>
    // https://stackoverflow.com/questions/1912501/unescape-html-entities-in-javascript
    function htmlDecode(input) {
        var e = document.createElement('textarea');
        e.innerHTML = input;
        // handle case of empty input
        return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
    }

    SimpleJekyllSearch({
        searchInput: document.getElementById('search-input'),
        resultsContainer: document.getElementById('search-results'),
        json: '/search.json',
        searchResultTemplate: '<div class="post-preview item"><a href="{url}"><h2 class="post-title">{title}</h2><h3 class="post-subtitle">{subtitle}</h3><hr></a></div>',
        noResultsText: 'No results',
        limit: 50,
        fuzzy: false,
        // a hack to get escaped subtitle unescaped. for some reason, 
        // post.subtitle w/o escape filter nuke entire search.
        templateMiddleware: function (prop, value, template) {
            if (prop === 'subtitle' || prop === 'title') {
                if (value.indexOf("code")) {
                    return htmlDecode(value);
                } else {
                    return value;
                }
            }
        }
    });

    $(document).ready(function () {
        var $searchPage = $('.search-page');
        var $searchOpen = $('.search-icon');
        var $searchClose = $('.search-icon-close');
        var $searchInput = $('#search-input');
        var $body = $('body');

        $searchOpen.on('click', function (e) {
            e.preventDefault();
            $searchPage.toggleClass('search-active');
            var prevClasses = $body.attr('class') || '';
            setTimeout(function () {
                $body.addClass('no-scroll');
            }, 400)

            if ($searchPage.hasClass('search-active')) {
                $searchClose.on('click', function (e) {
                    e.preventDefault();
                    $searchPage.removeClass('search-active');
                    $body.attr('class', prevClasses);  // from closure 
                });
                $searchInput.focus();
            }
        });
    });
</script>

<a id="rocket" href="#top" class=""></a>
<script type="text/javascript" src="/js/totop.js?v=1.0.0" async=""></script>
<script type="text/javascript" src="/js/toc.js?v=1.0.0" async=""></script>